<section id="content" class="news-b"> 	
	<form id="main_form" method="post">	
	<script type="text/javascript">
		function func_edit(id){
			$("#hidId").val(id);
			$("#hidInputType").val('update');
			$("#main_form").prop("action", "editSubject");
			return $("#main_form").submit();
		}
		
		function func_delete(id){
			var r=confirm("Are you sure?")
			if (r==true){
				$("#hidId").val(id);
				$("#main_form").prop("action", "deleteSubject");
				return $("#main_form").submit();
			}else{
				return;
			}
		}
		
		
	</script>	
	<input type="hidden" name="id" id="hidId" value="test"/>
	<input type="hidden" name="inputType" id="hidInputType" value="test"/>
   <div id="main_div">	
  	
  	<center><H1>Quản Lí Chương Trình Đào Tạo</H1></center>
  	<div id="regist">
  		<a style="margin-left:auto;" href="inputSubject">Thêm mới môn học</a>
  	</div>
   	<table id="main_table">
   		<tr>
   			<th width="100">Môn học</th>
   			<th width="450">Mô tả về môn học</th>
   			<th></th>
   		</tr>
   		<?php foreach ($subjects as $subject): ?>
   		<tr>
   			<td><?php echo $subject['Subject']['sub_name']; ?></td>
   			<td><?php echo $subject['Subject']['sub_descript']; ?></td>
   			<td>
   				<input class="btn" type="button" value="Cập nhật" onclick="func_edit(<?php echo $subject['Subject']['sub_id']; ?>)"/>
   				<input class="btn" type="button" value="Xóa" onclick="func_delete(<?php echo $subject['Subject']['sub_id']; ?>)"/>
   			</td>
   		</tr>
   		<?php endforeach; ?>
		<?php unset($subject); ?>
   	</table>
   </div>
   </form>
 </section>
